
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Rectangle)
{
        TEST(Rectangle Area should be : 9.511*5.515=52.40)
        {
                Shape   *pBase = new Rectangle(9.511,5.515);
                ASSERT_EQ(52.40, pBase->calcArea());
                delete pBase;
                pBase = 0;
        }

        TEST(ilegal rectangle length = 101)
        {
                Shape   *pBase = new Rectangle(101,5.515);
                ASSERT_EQ(0, pBase->calcArea());
                delete pBase;
                pBase = 0;
        }
        
        TEST(ilegal rectangle width = 76)
        {
                Shape   *pBase = new Rectangle(9.511,76);
                ASSERT_EQ(0, pBase->calcArea());
                delete pBase;
                pBase = 0;
        }

        TEST(Rectangle Perimeter should be: (9.511+5.515)*2=30.04)
        {
                Shape   *pBase = new Rectangle(9.511,5.515);
                ASSERT_EQ(30.04, pBase->calcPerimeter());
                delete pBase;
                pBase = 0;
        }
        
        TEST(Square Area should be : 9.511*9.511=90.44)
        {
                Shape   *pBase = new Square(9.511);
                ASSERT_EQ(90.44, pBase->calcArea());
                delete pBase;
                pBase = 0;
        }

        TEST(ilegal square line = 76)
        {
                Shape   *pBase = new Square(76);
                ASSERT_EQ(0, pBase->calcArea());
                delete pBase;
                pBase = 0;
        }

        TEST(Square Perimeter should be: 9.511*4=38.04)
        {
                Shape   *pBase = new Square(9.511);
                ASSERT_EQ(38.04, pBase->calcPerimeter());
                delete pBase;
                pBase = 0;
        }
};
